home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / hity wydania / Ubuntu 9.10 PL / karmelkowy-koliberek-desktop-9.10-i386-PL.iso / casper / filesystem.squashfs / bin / select_mountpoint < prev    next >
Text File  |  2009-01-11  |  1KB  |  71 lines

  1. #!/bin/sh
  2.  
  3. . /usr/share/debconf/confmodule
  4.  
  5. dev=$1
  6. id=$2
  7. part=$dev/$id
  8.  
  9. cd $dev
  10.  
  11. do_mountpoint () {
  12.     local noninteractive
  13.     noninteractive=true
  14.     while true; do
  15.         if [ -f "$part/mountpoint" ]; then
  16.             old_mountpoint=$(cat $part/mountpoint)
  17.         else
  18.             old_mountpoint=/
  19.         fi
  20.         db_set partman-basicfilesystems/mountpoint "$old_mountpoint"
  21.         db_input critical partman-basicfilesystems/mountpoint || $noninteractive
  22.         db_go || return 1
  23.         db_get partman-basicfilesystems/mountpoint
  24.  
  25.         case "$RET" in
  26.             Do?not?mount?it)
  27.             rm -f $part/mountpoint
  28.             break
  29.             ;;
  30.             Enter?manually)
  31.             if do_mountpoint_manual; then break; fi
  32.             noninteractive="return 1"
  33.             ;;
  34.             *)
  35.             echo ${RET%% *} >$part/mountpoint
  36.             break
  37.         esac
  38.     done
  39. }
  40.  
  41. do_mountpoint_manual () {
  42.     local noninteractive
  43.     noninteractive=true
  44.     while true; do
  45.         new_mountpoint=
  46.         while [ -z "$new_mountpoint" ]; do
  47.             if [ -f "$part/mountpoint" ]; then
  48.                 old_mountpoint=$(cat $part/mountpoint)
  49.             else
  50.                 old_mountpoint=/
  51.             fi
  52.             db_set partman-basicfilesystems/mountpoint_manual "$old_mountpoint"
  53.             db_input critical partman-basicfilesystems/mountpoint_manual || \
  54.                 $noninteractive
  55.             db_go || return 1
  56.             db_get partman-basicfilesystems/mountpoint_manual
  57.  
  58.             if expr "$RET" : '/[^ ]*$' >/dev/null; then
  59.                 new_mountpoint=$RET
  60.             else
  61.                 db_input high partman-basicfilesystems/bad_mountpoint || true
  62.                 db_go || true
  63.             fi
  64.         done
  65.         echo $RET >$part/mountpoint
  66.         break
  67.     done
  68. }
  69.  
  70. do_mountpoint
  71.